# from src.utils.config import logger
# from src.utils.db_processor import mysql_processor,presto_processor,hive_processor
# from src.utils.redis_pool import redis_conn
# from src.utils.util import get_today
#
#
# def insert_mobile_reference_price():
#     """
#     将手机规则计算的参考价插入到redis中
#     :return:
#     """
#     logger.info('insert mobile reference price...')
#
#     today = get_today()
#     sql = """
#     SELECT orp.product_sku_key, orp.product_level_key, orp.price_latest_28 AS reference_price
#     FROM fact_opt_reference_price orp
#     JOIN dim_product_sku dps ON orp.product_sku_key = dps.product_sku_key
#     JOIN dim_product dp ON dps.product_key = dp.product_key
#     WHERE DATE = '{}' AND dp.product_category_key = 1
#     """.format(today.strftime('%Y-%m-%d'))
#     reference_price = mysql_processor.load_sql(sql)
#
#     reference_price.index = 'abtest_' + reference_price['product_sku_key'].astype(str) + '_' + \
#                             reference_price['product_level_key'].astype(str)
#     logger.info('insert reference data into redis...')
#     redis_dict = reference_price['reference_price'].to_dict()
#     for key, value in redis_dict.items():
#         redis_conn.set(key, value)
#
#     logger.info('insert mobile reference price done')
#
# query_sql="""
# select * from dim.dim_product
# """
# df = presto_processor.load_sql(query_sql)
# df = hive_processor.load_sql(query_sql)

from pyhive import presto,hive

# [presto]
# db_host=trino.aihuishou.com
# db_port=9090
# db_user=u_algorithm
# db_password=L00easy_abprice_4567
# db_database_name=warehouse
# db_schema=rpt
session_pass={'password':'123'}
# 连接Hive
conn = presto.connect(
    host='10.193.64.163',
    port=9090,
    username='u_algorithm',
session_props=session_pass
)

# 读取Hive表数据
cursor = conn.cursor()
cursor.execute("select * from dim.dim_product limit 100")
df = cursor.fetchall()


print(df)
